package com.heatingcharge.mapper.sys;

import com.heatingcharge.entity.sys.SysUserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户角色表  Mapper 接口
 * </p>
 *
 * @author devin.jiang
 * @since 2019-06-27
 */
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
    @Select("SELECT r.name as roleName,ur.role_id \n" +
            "FROM (sys_role r LEFT JOIN sys_user_role ur ON r.id = ur.role_id ) \n" +
            "WHERE ur.user_id = #{userId}")
    List<SysUserRole> selectUserRoleListByUserId(Integer userId);
}
